package com.xgy.ordering.entity;

import java.time.LocalDateTime;
import java.util.Objects;

public class Order {
    private String id;
    private String customerName;
    private double totalAmount;
    private String foodItems;
    private LocalDateTime createTime;
    private OrderStatus status;

    public enum OrderStatus {
        PENDING, CONFIRMED, PREPARING, DELIVERED, CANCELLED
    }

    public Order(String id, String customerName, double totalAmount, String foodItems, LocalDateTime createTime, OrderStatus status) {
        this.id = id;
        this.customerName = customerName;
        this.totalAmount = totalAmount;
        this.foodItems = foodItems;
        this.createTime = createTime;
        this.status = status;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getCustomerName() {
        return customerName;
    }

    public void setCustomerName(String customerName) {
        this.customerName = customerName;
    }

    public double getTotalAmount() {
        return totalAmount;
    }

    public void setTotalAmount(double totalAmount) {
        this.totalAmount = totalAmount;
    }

    public String getFoodItems() {
        return foodItems;
    }

    public void setFoodItems(String foodItems) {
        this.foodItems = foodItems;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public OrderStatus getStatus() {
        return status;
    }

    public void setStatus(OrderStatus status) {
        this.status = status;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Order order = (Order) o;
        return Objects.equals(id, order.id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id);
    }

    @Override
    public String toString() {
        return String.format("Order{id=%s, customer=%s, amount=%.2f, status=%s}",
                id, customerName, totalAmount, status);
    }
}